package edu.whu.webgis.mapper;

import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import edu.whu.webgis.entity.User;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Select;
import org.apache.ibatis.annotations.Update;

import java.util.List;
import java.util.Map;

@Mapper
public interface UserMapper extends BaseMapper<User> {
    @Select("select * from public.user where id = #{id}")
    User selectById(String id);
    @Select("select avatar from public.user where id = #{id}")
    String selectAvatar(String id);

    @Select("select id,name from public.user")
    List<Map<String,String>> selectAllBaseInfo();

    @Update("update public.user set signature = #{intro},nickname= #{nickname} where id= #{uid}")
    void updateBaseDetail(String uid,String intro,String nickname);


    @Update("update public.user set avatar = #{path} where id = #{uid}")
    void updatePhoto(String path,String uid);

}
